﻿<phone:PhoneApplicationPage
    x:Class="Coding4Fun.Lockscreen.Mobile.ImageSetPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:controls="clr-namespace:Coding4Fun.Lockscreen.Mobile.Controls"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False"
    shell:SystemTray.BackgroundColor="#f28715">

    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="ListItemTemplate">
            <Grid Margin="0,0,12,12" Background="#f28715">
                <Image Stretch="UniformToFill" Source="{Binding URL}"></Image>
                <Grid VerticalAlignment="Bottom" Height="50">
                    <Grid.Background>
                        <SolidColorBrush Color="Black" Opacity=".5"></SolidColorBrush>
                    </Grid.Background>

                    <TextBlock Foreground="White" VerticalAlignment="Center" Margin="8,0,0,0" Text="{Binding Name}" Style="{StaticResource PhoneTextTitle3Style}"></TextBlock>
                </Grid>
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>

    <Grid x:Name="LayoutRoot" Background="#1266a7">
        <TextBlock Foreground="White" Style="{StaticResource PhoneTextExtraLargeStyle}" Text="{Binding Path=Instance.CurrentCategory.Name,
            Source={StaticResource CentralBindingPoint}}"></TextBlock>
        
        <ListBox 
            SelectionMode="Single"
            Margin="12,72,12,12"
            x:Name="lstImages" SelectionChanged="lstImages_SelectionChanged_1"
            ItemsSource="{Binding Path=Instance.CurrentCategory.Images,
            Source={StaticResource CentralBindingPoint}}"
            ItemTemplate="{StaticResource ListItemTemplate}">
            
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <toolkit:WrapPanel ItemWidth="228" ItemHeight="260"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>

        <Grid x:Name="grdDownloading" Visibility="Collapsed">
            <Grid.Background>
                <SolidColorBrush Color="Black" Opacity=".8"></SolidColorBrush>
            </Grid.Background>
            
            <TextBlock Foreground="White" Text="Downloading..." HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
            <toolkit:PerformanceProgressBar HorizontalAlignment="Center" VerticalAlignment="Center" Width="200" Height="40" Margin="0,80,0,0" ActualIsIndeterminate="True" FlowDirection="LeftToRight"
                                            IsIndeterminate="True"></toolkit:PerformanceProgressBar>
        </Grid>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default" Opacity="1.0" >
            <shell:ApplicationBarIconButton x:Name="btnSetStack" IconUri="/Images/check.png" Text="set active" Click="btnSetStack_Click_1"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>